﻿<UserControl x:Class="caedisi.Views.Controls.BasicCellControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400"
    xmlns:Converters="clr-namespace:caedisi.Converters"
    xmlns:Helpers="clr-namespace:caedisi.Helpers"
   
             >
    
    <UserControl.Resources>
        <Converters:ColorToBrushConverter x:Name="ColorToBrushConverter"/>
        <Helpers:GlobalVariableProvider x:Key="GlobalVariableProvider" />
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="5"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="5"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="5"/>
        </Grid.ColumnDefinitions>        
        <!--Overlapping controls-->
        <ComboBox  Grid.Row="1"  Grid.Column="1"  ItemsSource="{Binding Source={StaticResource GlobalVariableProvider}, Path=GlobalVariables.Lovs.CellStateTypes, Mode=TwoWay}" SelectedValuePath="CellStateTypeId" SelectedValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=SelectedCellStateTypeId, Mode=TwoWay}" Width="20" Height="20" Style="{StaticResource ComboBoxCACellStyle}">
            <ComboBox.ItemTemplate>
                <DataTemplate>                        
                    <StackPanel Orientation="Horizontal" Margin="0,3,0,3">
                        <Ellipse Width="12" Height="12" Fill="{Binding Path=Color, Converter={StaticResource ColorToBrushConverter}}" Stroke="Black" StrokeThickness="0.5" />
                        <TextBlock Width="150" Text="{Binding Path=Name}" VerticalAlignment="Center" FontSize="12" Margin="3,0,0,0" />
                        <TextBlock Text="{Binding Path=AliasCharacter}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="12"  />                        
                    </StackPanel>
                </DataTemplate>
            </ComboBox.ItemTemplate>                
        </ComboBox>
        <Ellipse Grid.Row="1" Grid.Column="1"  Width="12" Height="12"  Fill="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl},  Path=SelectedCellStateType.Color, Converter={StaticResource ColorToBrushConverter}}" Name="innerEllipse" Stroke="Black" StrokeThickness="0.5"/>
    </Grid>
</UserControl>
